Web installer was not checking for unsupported PHP versions.
In those cases the script should terminate or the
installation will break (e.g. syntax errors for PHP4).
Installer::doEnvironmentChecks() no longer checks for PHP
version since it has already been done by the entry scripts
(both in cli and web modes)
Installer::MINIMUM_PHP_VERSION has been removed since it is
no longer used.
Message config-env-php-toolow is no longer used and it has
been removed
Change-Id: I9227868bd2bd4e13bad6b95ad581be3ada71c94e
* - index.php
* - load.php
* - api.php
+ * - mw-config/index.php
* - cli
*
* @note Since we can't rely on anything, the minimum PHP versions and MW current
$finalOutput = "You are using PHP version $phpVersion "
. "but MediaWiki $mwVersion needs PHP $minimumVersionPHP or higher. ABORTING.\n"
. "Check if you have a newer php executable with a different name, such as php5.\n";
- } elseif ( $type == 'index.php' ) {
+ } elseif ( $type == 'index.php' || $type == 'mw-config/index.php' ) {
$pathinfo = pathinfo( $_SERVER['SCRIPT_NAME'] );
+ if ( $type == 'mw-config/index.php' ) {
+ $dirname = dirname( $pathinfo['dirname'] );
+ } else {
+ $dirname = $pathinfo['dirname'];
+ }
$encLogo = htmlspecialchars(
- str_replace( '//', '/', $pathinfo['dirname'] . '/' ) .
+ str_replace( '//', '/', $dirname . '/' ) .
'skins/common/images/mediawiki.png'
);
*/
abstract class Installer {
- // This is the absolute minimum PHP version we can support
- const MINIMUM_PHP_VERSION = '5.3.2';
-
/**
* The oldest version of PCRE we can support.
*
* @return Status
*/
public function doEnvironmentChecks() {
- $phpVersion = phpversion();
- if ( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
- $this->showMessage( 'config-env-php', $phpVersion );
- $good = true;
- } else {
- $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
- $good = false;
- }
+ // Php version has already been checked by entry scripts
+ // Show message here for information purposes
+ $this->showMessage( 'config-env-php', phpversion() );
+ $good = true;
// Must go here because an old version of PCRE can prevent other checks from completing
- if ( $good ) {
- list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
- if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
- $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
- $good = false;
- }
- }
-
- if ( $good ) {
+ list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
+ if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
+ $this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
+ $good = false;
+ } else {
foreach ( $this->envChecks as $check ) {
$status = $this->$check();
if ( $status === false ) {
"config-env-good": "The environment has been checked.\nYou can install MediaWiki.",
"config-env-bad": "The environment has been checked.\nYou cannot install MediaWiki.",
"config-env-php": "PHP $1 is installed.",
- "config-env-php-toolow": "PHP $1 is installed.\nHowever, MediaWiki requires PHP $2 or higher.",
"config-unicode-using-utf8": "Using Brion Vibber's utf8_normalize.so for Unicode normalization.",
"config-unicode-using-intl": "Using the [http://pecl.php.net/intl intl PECL extension] for Unicode normalization.",
"config-unicode-pure-php-warning": "<strong>Warning:</strong> The [http://pecl.php.net/intl intl PECL extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read a little on [//www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].",
* @file
*/
+// Bail if PHP is too low
+if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+ // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
+ require dirname( dirname( __FILE__ ) ) . '/includes/PHPVersionError.php';
+ wfPHPVersionError( 'mw-config/index.php' );
+}
+
define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
define( 'MEDIAWIKI_INSTALL', true );